package com.itheima.day03_extends.homework06;

public class Test {
    /*
    【编号：1007】结合继承的思想，分析下列需求并实现
    定义项目经理类Manager 【属性：姓名 工号 工资 奖金】【行为：工作work】
    定义程序员类Coder【属性：姓名 工号 工资】【行为：工作work】
    要求：通过有参构造创建两个类的对象，并调用各自的work方法
    运行结果：
    姓名为:张三,工号为:9527,工资为:10000.0,的程序员正在编写代码
    姓名为:李四,工号为:9528,工资为:15000.0,奖金为:2000.0,的项目经理正在管理程序员写代码
     */
    public static void main(String[] args) {
        Coder c = new Coder("张三","9527",10000);
        c.work();
        Manager m = new Manager("李四","9528",15000,2000);
        m.work();
    }
}
abstract class Person {
    private String name;
    private String sid;
    private double salary;

    public Person() {
    }

    public Person(String name, String sid, double salary) {
        this.name = name;
        this.sid = sid;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSid() {
        return sid;
    }

    public void setSid(String sid) {
        this.sid = sid;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public abstract void work();
}

class Coder extends Person{

    public Coder() {
    }

    public Coder(String name, String sid, double salary) {
        super(name, sid, salary);
    }

    @Override
    public void work() {
        System.out.println("姓名为:"+getName()+",工号为:"+getSid()+",工资为:"+getSalary()+",的程序员正在编写代码");
    }
}

class Manager extends Person{
    private double reward;

    public Manager() {
    }

    public Manager(String name, String sid, double salary, double reward) {
        super(name, sid, salary);
        this.reward = reward;
    }

    public double getReward() {
        return reward;
    }

    public void setReward(double reward) {
        this.reward = reward;
    }

    @Override
    public void work() {
        System.out.println("姓名为:"+getName()+",工号为:"+getSid()+",工资为:"+getSalary()+",奖金为:"+getReward()+",的项目经理正在管理程序员写代码");
    }
}